/*
*	File: CoreMaterial.cpp
*	Date: 12/15/2011
*	Author: Ivan Gao
*	Desc:
*/
#include "CoreMaterial.h"

SCoreMaterial::SCoreMaterial ()
{

}

SCoreMaterial::SCoreMaterial (const SCoreMaterial & rMtl) 
	: m_ambientColor (rMtl.m_ambientColor),
	m_diffuseColor (rMtl.m_diffuseColor),
	m_specularColor (rMtl.m_specularColor),
	m_shininess (rMtl.m_shininess),
	m_strName (rMtl.m_strFileName),
	m_strFileName (rMtl.m_strName),
	m_vecMap (rMtl.m_vecMap)
{

}

SCoreMaterial::~SCoreMaterial ()
{

}

const SCoreMaterial::Color & SCoreMaterial::GetAmbientColor () const
{
	return m_ambientColor;
} // GetAmbient

const SCoreMaterial::Color & SCoreMaterial::GetDiffuseColor () const
{
	return m_diffuseColor;
} // GetDiffuseColor

const SCoreMaterial::Color & SCoreMaterial::GetSpecularColor() const
{
	return m_specularColor;
} // GetSpecularColor

float SCoreMaterial::GetShiness() const
{
	return m_shininess;
} // GetShiness

int SCoreMaterial::GetMapCount() const
{
	return m_vecMap.size ();
} // GetMapCount

const string & SCoreMaterial::GetMapFileName (int nMapId) const
{
	if (nMapId < 0 || nMapId >= (int)m_vecMap.size ())
	{
		static string str;
		return str;
	} // if
	return m_vecMap[nMapId].strFileName;
} // GetMapFileName

const string & SCoreMaterial::GetMapType (int nMapId) const
{
	if (nMapId < 0 || nMapId >= (int)m_vecMap.size())
	{
		static string str;
		return str;
	} // if
	return m_vecMap[nMapId].strType;
} // GetMapType

const string & SCoreMaterial::GetFileName() const
{
	return m_strFileName;
} // GetFileName

const string & SCoreMaterial::GetName() const
{
	return m_strName;
} // GetName

vector<SCoreMaterial::Map> & SCoreMaterial::GetVectorMap ()
{
	return m_vecMap;
} // GetVectorMap

bool SCoreMaterial::Reserve (int nMapCount)
{
	bool bSuccess = true;
	try
	{
		m_vecMap.reserve (nMapCount);
	}
	catch (...)
	{
		bSuccess = false;
	} 
	return bSuccess;
} // Reserve

void SCoreMaterial::SetAmbientColor(const Color & ambientColor)
{
	m_ambientColor = ambientColor;
} // SetAmbientColor

void SCoreMaterial::SetDiffuseColor(const Color & diffuseColor)
{
	m_diffuseColor = diffuseColor;
} // SetDiffuseColor

void SCoreMaterial::SetSpecularColor (const Color & specularColor)
{
	m_specularColor = specularColor;
} // SetSpecularColor

void SCoreMaterial::SetShininess(float shininess)
{
	m_shininess = shininess;
} // SetShininess

bool SCoreMaterial::SetMap (int nMapId, const Map & map)
{
	if (nMapId < 0 || nMapId >= (int)m_vecMap.size())
	{
		return false;
	} // if
	m_vecMap[nMapId] = map;
	return true;
} // SetMap

void SCoreMaterial::AddMap (const Map & map)
{
	m_vecMap.push_back(map);
} // AddMap

void SCoreMaterial::SetFileName (const char * pFileName)
{
	m_strFileName = pFileName;
} // SetFileName

void SCoreMaterial::SetName (const char  * pName)
{
	m_strName = pName;
} // SetName









